
<div class="latest">
		<div class="list-group product-list">
                    <?php
                        App::import('Include', 'resizeImage');
                    ?>
                    
                    <?php 
                        echo '<h3 class="list-group-item"><i class="latest-icon"></i>All Ads';
                        echo '<span class="btn view-all">'.$this->Html->link('Back', array('controller' => 'posts', 'action' => 'index')).'</span></h3>';
                    ?>
		<div class="list-group-item">
		<?php 
                    foreach ($products as $product):
                        echo '<div class="item">';
                            $image=$product['Product']['picture1'];
                            if(empty($image)){
                                $image = 'default_product.png';
                                $resizedFile = 'img/uploads/'.$image;
                            }else {
                               $resizedFile = 'img/uploads/images_resize/'.$image;
                            }
                            echo '<a href="'.$this->webroot.'posts/view/'.$product['Product']['id'].'"><img style="width: 100px; height: 100px; "src="'.$this->webroot.$resizedFile.'"/></a>';
                            
                            
                            if (strlen($product['Product']['title']) > 10) {
                                echo '<span class="pro-title">'.$this->Html->link(substr($product['Product']['title'], 0, 10).'...', array('controller' => 'posts', 'action' => 'view', $product['Product']['id'])).'</span>';
                            }else {
                                echo '<span class="pro-title">'.$this->Html->link($product['Product']['title'], array('controller' => 'posts', 'action' => 'view', $product['Product']['id'])).'</span>';
                            }
                            
                            echo '<span id="pro-price">$'.$product['Product']['price'].'<i class="'.$product['Product']['status'].'"></i></span><br>';
                            echo '<span id="auth">'.$product['Product']['name'].'</span><br>';
                            echo '<span id="address">'.$product['Location']['name'].'</span><br>';
                            echo '<span id="phone">'.$product['Product']['phone'].'</span><br>';
                            echo '</div>';
                            
                    endforeach;
                ?>

	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
		</div>
    </div>
</div>